﻿namespace ProjectAutumn.Graphics
{
    public abstract class GraphicsDevice : DeviceBase
    {
        protected Game Game;
        protected GraphicsDevice(Game game)
        {
            IsFullScreen = false;
            BackBufferHeight = 600;
            BackBufferWidth = 800;
            Game = game;
        }
        public abstract void Clear(Color color);
        protected internal abstract Texture LoadTexture(string file);
        protected internal abstract void BeginDraw();
        public abstract void Begin2D();
        public abstract void End2D();
        public abstract void Draw(Texture texture, Vector2 position, Rectangle? source, Color tint, float rotation, Vector2 offset, float scale);
        public void Draw(Texture texture, Vector2 vector, Color tint)
        {
            Draw(texture, vector, null, tint, 0, Vector2.Zero, 1);
        }
        protected internal abstract void EndDraw();
        public bool IsFullScreen { get; set; }
        public int BackBufferWidth { get; set; }
        public int BackBufferHeight { get; set; }
        public abstract int Width { get; }
        public abstract int Height { get; }
        public abstract Texture CreateTexture(int width, int height);
        private bool mouseVisible;
        public bool IsMouseVisible
        {
            get
            {
                return mouseVisible;
            }
            set
            {
                mouseVisible = value;
                SetMouseVisibility(value);
            }
        }
        protected abstract void SetMouseVisibility(bool value);
        protected abstract void ApplyChanges(int width, int height, bool isFullscreen);
        public void ApplyChanges()
        {
            Game.WindowDevice.ApplyChanges(BackBufferWidth, BackBufferHeight, IsFullScreen);
            ApplyChanges(BackBufferWidth, BackBufferHeight, IsFullScreen);
        }
        public abstract GraphicCapabilities GraphicCapabilities { get; }
    }
}
